Skip to content

fix: Add validation to ensure added auth token getters are used by the tool #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2025

Conversation

anubhav756
Copy link
Contributor

Problem

Previously, the ToolboxTool.add_auth_token_getters method only validated against existing registered getters or conflicts with client headers. It did not verify if all the auth token getters provided were actually used or required by the specific tool instance they were being added to.

Solution

This PR enhances the validation in add_auth_token_getters. It now leverages the used_auth_token_getters information returned by the existing identify_required_authn_params call. This allows the method to confirm that every getter passed in is genuinely required by the tool, raising an error if any are unused.

Benefit

This ensures that only relevant auth token getters are attempted to be registered for a tool, preventing misconfigurations and human errors.

Note

This validation aligns with the existing validation logic already present in the ToolboxClient.load_tool method, promoting a consistent approach to handling auth token getter requirements across the codebase.

@anubhav756 anubhav756 self-assigned this May 5, 2025
@anubhav756 anubhav756 requested a review from a team as a code owner May 5, 2025 15:17
@anubhav756 anubhav756 marked this pull request as draft May 5, 2025 16:28
@anubhav756 anubhav756 force-pushed the anubhav-tool-unused-auth branch 2 times, most recently from 06847ff to 4405195 Compare May 6, 2025 11:56
@anubhav756 anubhav756 marked this pull request as ready for review May 6, 2025 11:58
@anubhav756 anubhav756 changed the base branch from anubhav-error to anubhav-fix-authz-required May 9, 2025 18:56
@anubhav756 anubhav756 force-pushed the anubhav-fix-authz-required branch from 854ef47 to e664e96 Compare May 12, 2025 14:12
@anubhav756 anubhav756 force-pushed the anubhav-tool-unused-auth branch from 4405195 to 3232752 Compare May 12, 2025 14:12
@anubhav756 anubhav756 force-pushed the anubhav-fix-authz-required branch from e664e96 to 6740434 Compare May 13, 2025 09:10
Base automatically changed from anubhav-fix-authz-required to main May 13, 2025 09:16
…e tool

Previously, the `ToolboxTool.add_auth_token_getters` method only validated against existing registered getters or conflicts with client headers. It did not verify if *all* the auth token getters provided were actually used or required by the specific tool instance they were being added to.

This PR enhances the validation in `add_auth_token_getters`. It now leverages the `used_auth_token_getters` information returned by the existing `identify_required_authn_params` call. This allows the method to confirm that every getter passed in is genuinely required by the tool, raising an error if any are unused.

This ensures that only relevant auth token getters are attempted to be registered for a tool, preventing misconfigurations and human errors.

> [!NOTE]
> This validation aligns with the existing validation logic already present in the `ToolboxClient.load_tool` method, promoting a consistent approach to handling auth token getter requirements across the codebase.
@anubhav756 anubhav756 force-pushed the anubhav-tool-unused-auth branch from 3232752 to 88175d7 Compare May 13, 2025 09:50
@anubhav756 anubhav756 merged commit 7cde398 into main May 13, 2025
19 checks passed
@anubhav756 anubhav756 deleted the anubhav-tool-unused-auth branch May 13, 2025 09:53
@release-please release-please bot mentioned this pull request May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants